<?php
/*##################################################

# 模块功能：lywq微信对接配置
###################################################*/
error_reporting(0);
header("Content-Type: text/html;charset=utf-8");
if(!@$_SERVER['HTTP_REFERER']) header('location:/');

$ssl = 'http://';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') {
    $ssl = 'https://';
}

$info = 'info.ini';
$infoL = '../../application/admin/view/lywq/Wechat/info.ini';
$LywqwechatL = '../../application/api/controller/Lywqwechat.php';
$Lywqwechat = 'php/Lywqwechat.php';
$LywqWechatPublicL = '../../application/common/util/LywqWechatPublic.php';
$LywqWechatPublic = 'php/LywqWechatPublic.php';
$RndPassword = 'config/RndPassword.php';
$version = parse_ini_file($info);
$versionL = parse_ini_file($infoL);

if (!file_exists($LywqwechatL) || !file_exists($LywqWechatPublicL) || $version['version']!=$versionL['version']) {
  // 删除php文件
  if(!unlink($LywqwechatL)){
    unlink('../../application/api/controller/Lywqwechat.php');
  }
  if(!unlink($LywqWechatPublicL)){
    unlink('../../application/common/util/LywqWechatPublic.php');
  }
	copy($info,$infoL);
	copy($Lywqwechat,$LywqwechatL);
	copy($LywqWechatPublic,$LywqWechatPublicL);
}
if (!file_exists($RndPassword)) {
  exit('未检测到config.php配置文件,请检查 addons/Wechat/config/RndPassword.php 文件是否存在！');
}
if (!file_exists($info)) {
	exit('未检测到info.ini配置文件,请检查 addons/Wechat/info.ini 文件是否存在！');
}
$config = './config/config.php';
if (!file_exists($config)) {
  $configfile = fopen("./config/config.php", "w") or die("Unable to open file!");
  fwrite($configfile, "<?php $"."lywq "."=array ();");
  fclose($configfile);
}
require($config);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>lywq微信对接设置</title>
    <link href="/static/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <script src="/static/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	<script src="/static/js/jquery.js"></script>
	<style>.layui-input-inline textarea{min-width:300px;min-height:150px;}
	.layui-form-item .layui-form-label{min-width:130px;}
	</style>
</head>
<body style="margin:20px 20px">
<style>.showpic {position:absolute; max-width:400px; max-height:500px; text-align:center; line-height:150%; border:2px solid #DEEFFA; padding:5px; background:#FFFFFF;  z-index:99999;}</style>
<div class="showpic" style="display:none;"><img class="showpic_img" width="100%" height="100%"></div>
<form class="layui-form layui-form-pane" action="">
<div class="layui-tab">
  <ul class="layui-tab-title">
    <li class="layui-this">lywq微信对接</li>
    <li>赞助支持</li>
    <li>基本设置</li>
    <li>观影密码设置</li>
    <li>自定义关键词设置</li>
  </ul>
  <div class="layui-tab-content">
    <!-- 介绍页 -->
    <div class="layui-tab-item layui-show">
      <blockquote class="layui-elem-quote layui-quote-nm">
        <p>欢迎使用lywq微信对接插件</p>
      </blockquote>
      <table class="layui-table">
        <colgroup>
          <col width="100">
            <col width="150">
              <col></colgroup>
        <thead>
          <tr>
            <th colspan="2" scope="col">插件简介</th>
            <th colspan="1" scope="col">使用说明</th></tr>
        </thead>
        <tbody>
          <tr>
            <td>名称</td>
            <td>
              <a href="https://www.muyin.life" target="_blank"><?php echo $version['title'] ;?> <?php echo $version['version'] ;?></a></td>
            <td>1. PHP版本≥5.6</td></tr>
          <tr>
            <td>作者</td>
            <td>
              <a href="<?php echo $version['website'] ;?>" target="_blank"><?php echo $version['author'] ;?></a></td>
            <td>2. 插件均为作者原创开发，不定时更新。</td></tr>
          <tr>
          <td>官方Q群</td>
            <td>
              <a href="https://jq.qq.com/?_wv=1027&k=szDVe4dO" target="_blank">294075802</a></td>
            <td>3. 意见、反馈、功能建议，请加入官方QQ群一起沟通交流！</td></tr>
          <tr>
            <td>作者QQ</td>
            <td>
              <a href="http://wpa.qq.com/msgrd?v=3&uin=<?php echo $version['qq'] ;?>&site=qq&menu=yes" target="_blank"><?php echo $version['qq'] ;?></a></td>
            <td>4. 唯一官方QQ，购买非官方制作源码，无任何技术支持及售后服务！</td></tr>
          <tr>
            <td>更新时间</td>
            <td><?php echo $version['updatetime'] ;?></td>
            <td>5. 肆意散播转售或者倒卖，将视为放弃一切技术支持。</td></tr>
          <tr>
            <td style="color:red;">使用教程</td>
            <td>
              <a href="<?php echo $version['tutorial'] ;?>" style="color:blue;" target="_blank">查看教程</a></td>
            <td>6. 使用盗版源码遇到任何问题本人概不负责！</td></tr>
          <tr>
            <td style="color:red;">更新日志</td>
            <td colspan="2" style="color:#2E8B57;">
              <?php echo $version['updatelog'] ;?></td></tr>
          <tr>
            <td colspan="3">请务必尊重知识产权，严格保证不恶意传播产品源码、不得直接对源码进行二次转售或倒卖等。一经发现，我们有权利终止你在我方购买的所有源码的售后技术支持。</td></tr>
        </tbody>
      </table>
    </div>

    <!-- 赞助支持 -->
    <div class="layui-tab-item">
      <blockquote class="layui-elem-quote layui-quote-nm">
        <p>您好，首先非常感谢您使用lywq微信对接插件！</p>
        <p>本插件为<span style="color:red;">完全免费</span>插件，目前作者唯一收入为捐赠，免费程序的开发离不开金钱，还请各位多多支持！</p>
        <p></p>
        <p></p>
      </blockquote>
      <!--赞赏二维码-->
      <table class="layui-table">
        <thead>
          <tr>
            <th colspan="3">赞赏部分</th>
        </tr>
        </thead>
        <tbody>
            <tr align="center">
                <td width="20%">微信二维码</td>
                <td width="20%">支付宝二维码</td>
                <td width="60%">话说</td>
            </tr>
            <tr align="center">
                <td width="20%"><a href="https://s3.ax1x.com/2021/02/01/yVBih8.png" target="_blank"><img src="https://s3.ax1x.com/2021/02/01/yVBih8.png" width="auto" /></a></td>
                <td width="20%"><a href="https://s3.ax1x.com/2021/02/01/yVBk9S.jpg" target="_blank"><img src="https://s3.ax1x.com/2021/02/01/yVBk9S.jpg" width="280px" /></a></td>
                <td width="60%">
                <p style="color:#FF0000;">自愿赞赏，不强求，金额随意，一分也是爱！</p>
                <p style="color:#FF8C00;">您的支持将是我最大的动力，加油，奥力给！</p>
                <p><a style="color:	#1E90FF;" href="https://jq.qq.com/?_wv=1027&k=szDVe4dO" target="_blank">点击进群，一起交流插件！</a></p>
                </td>
            </tr>
        </tbody>
      </table>
      <!--广告赞助-->
      <table class="layui-table">
        <thead>
          <tr>
            <th colspan="3">广告部分</th>
        </tr>
        </thead>
        <tbody>
            <tr align="center">
                <td>
                   <iframe src="https://www.muyin.life/ads/lywq_Wechat/lywq_Wechat_ads.html" width="100%" height="320px" frameborder="0" scrolling="yes"></iframe>
                </td>
            </tr>
        </tbody>
      </table>
      <!--友情链接-->
      <table class="layui-table">
        <thead>
          <tr>
            <th colspan="3">友链部分</th>
        </tr>
        </thead>
        <tbody>
            <tr align="center">
                <td>
                   <iframe src="https://www.muyin.life/ads/lywq_Wechat/lywq_Wechat_link.html" width="100%" height="180px" frameborder="0" scrolling="yes"></iframe>
                </td>
            </tr>
        </tbody>
      </table>
    </div>

    <!-- 基本设置 -->
    <div class="layui-tab-item">
      <blockquote class="layui-elem-quote layui-quote-nm">
        <p style="color:red;">这里的对接配置与程序原本配置不冲突，可以同时使用</p>
        <p>
        	公众号对接域名、公众号搜索域名、网站域名通常一致，因公众号可能产生的封域名问题，你可以单独设置域名进行对接。
        </p>
        <p>
        	公众号后台对接地址：<span style="font-weight:bold;color:green;">http://<?php echo $lywq['Wechat']['duijie'];?>/api.php/Lywqwechat</span>
        </p>
      </blockquote>
      
        <div class="layui-form-item">
          <label class="layui-form-label">状态</label>
          <div class="layui-input-inline">
            <input type="checkbox" name="lywq_Wechat_status" lay-skin="switch" lay-text="开启|关闭" value="1" <?php echo $lywq['Wechat']['status']?'checked':'';?>>
          </div>
        </div>
	    <div class="layui-form-item">
           <label class="layui-form-label">对接域名：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_duijie" placeholder="请填写对接域名" value="<?php echo $lywq['Wechat']['duijie'];?>" autocomplete="off" class="layui-input">
           </div>
           <div class="layui-form-mid layui-word-aux">只填域名，不用http://</div>
	    </div>
	    <div class="layui-form-item">
           <label class="layui-form-label">搜索域名：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_sousuo" placeholder="请填写搜索域名" value="<?php echo $lywq['Wechat']['sousuo'];?>" autocomplete="off" class="layui-input">
           </div>
           <div class="layui-form-mid layui-word-aux">用于在微信公众号显示的域名，只填域名，不用http://</div>
	    </div>
	    <div class="layui-form-item">
           <label class="layui-form-label">对接token：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_token" placeholder="请填写对接token" value="<?php echo $lywq['Wechat']['token'];?>" autocomplete="off" class="layui-input">
           </div>
           <div class="layui-form-mid layui-word-aux">公众号后台对接的token密钥</div>
	    </div>
        <div class="layui-form-item">
           <label class="layui-form-label">关注回复：</label>
           <div class="layui-input-inline w300">
               <textarea name="lywq_Wechat_guanzhu" class="layui-input"  placeholder="请填写关注回复内容"><?php echo $lywq['Wechat']['guanzhu'];?></textarea>
           </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label">无资源回复：</label>
           <div class="layui-input-inline w300">
               <textarea name="lywq_Wechat_wuziyuan" class="layui-input"  placeholder="请填写无资源回复内容"><?php echo $lywq['Wechat']['wuziyuan'];?></textarea>
           </div>
        </div>
	    <div class="layui-form-item">
           <label class="layui-form-label">无资源回复链接：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_wuziyuanlink" placeholder="请填写无资源回复链接" value="<?php echo $lywq['Wechat']['wuziyuanlink'];?>" autocomplete="off" class="layui-input">
           </div>
	    </div>
        <div class="layui-form-item">
           <label class="layui-form-label">返回页面地址：</label>
           <div class="layui-input-inline" style="width:400px;">
             <input type="radio" name="lywq_Wechat_bofang" value="0" title="内容页面" <?php echo $lywq['Wechat']['bofang']==0?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_bofang" value="1" title="播放页面" <?php echo $lywq['Wechat']['bofang']==1?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_bofang" value="2" title="搜索页面" <?php echo $lywq['Wechat']['bofang']==2?'checked':'';?>>
           </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label">返回内容类型：</label>
           <div class="layui-input-inline" style="width:400px;">
             <input type="radio" name="lywq_Wechat_msgtype" value="0" title="图文" <?php echo $lywq['Wechat']['msgtype']==0?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_msgtype" value="1" title="链接" <?php echo $lywq['Wechat']['msgtype']==1?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_msgtype" value="2" title="地址" <?php echo $lywq['Wechat']['msgtype']==2?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_msgtype" value="3" title="图片" <?php echo $lywq['Wechat']['msgtype']==3?'checked':'';?>>
           </div>
           <div class="layui-form-mid layui-word-aux">微信图文只回复一条信息</div>
        </div>
        <div class="layui-form-item" <?php if ($lywq['Wechat']['msgtype'] != 3) { echo 'style="display:none;"';} ?> >
            <label class="layui-form-label">图片生成接口：</label>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_qrcode" placeholder="请填写图片生成接口" value="<?php echo $lywq['Wechat']['qrcode'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
        
        <div class="layui-form-item">
          <label class="layui-form-label">防红状态</label>
          <div class="layui-input-inline">
            <input type="checkbox" name="lywq_Wechat_antiRedStatus" lay-skin="switch" lay-text="开启|关闭" value="1" <?php echo $lywq['Wechat']['antiRedStatus']?'checked':'';?>>
          </div>
        </div>
        <div class="layui-form-item">
           <label class="layui-form-label">接口提供：</label>
           <div class="layui-input-inline" style="width:300px;">
             <input type="radio" name="lywq_Wechat_antiRedSupply" value="0" title="内置(已弃用)" <?php echo $lywq['Wechat']['antiRedSupply']==0?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_antiRedSupply" value="1" title="自定义" <?php echo $lywq['Wechat']['antiRedSupply']==1?'checked':'';?>>
           </div>
           <div class="layui-form-mid layui-word-aux">选择后请点击保存</div>
        </div>
        <div class="layui-form-item" <?php if ($lywq['Wechat']['antiRedSupply'] != 0) { echo 'style="display:none;"';} ?> >
           <label class="layui-form-label">访问方式：</label>
           <div class="layui-input-inline" style="width:400px;">
             <input type="radio" name="lywq_Wechat_antiRedType" value="0" title="直链访问" <?php echo $lywq['Wechat']['antiRedType']==0?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_antiRedType" value="1" title="提示访问" <?php echo $lywq['Wechat']['antiRedType']==1?'checked':'';?>>
             <input type="radio" name="lywq_Wechat_antiRedType" value="2" title="内嵌访问" <?php echo $lywq['Wechat']['antiRedType']==2?'checked':'';?>>
           </div>
        </div>
	    <div class="layui-form-item" <?php if ($lywq['Wechat']['antiRedSupply'] != 0) { echo 'style="display:none;"';} ?> >
           <label class="layui-form-label">用户Token：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_antiRedToken" placeholder="请填写用户token" value="<?php echo $lywq['Wechat']['antiRedToken'];?>" autocomplete="off" class="layui-input">
           </div>
           <button class="layui-btn" onclick="javascript(0);"><a target="_blank" href="https://antired.muyin.life/user/uset.php?mod=token">获取token</a></button>
           <button class="layui-btn" onclick="javascript(0);"><a target="_blank" href="https://antired.muyin.life/static/picture/gettoken.gif">查看教程</a></button>
	    </div>
	    <div class="layui-form-item" <?php if ($lywq['Wechat']['antiRedSupply'] != 1) { echo 'style="display:none;"';} ?> >
           <label class="layui-form-label">防红接口：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_antiRedApi" placeholder="请填写防红接口" value="<?php echo $lywq['Wechat']['antiRedApi'];?>" autocomplete="off" class="layui-input">
           </div>
	    </div>
	    <div class="layui-form-item" <?php if ($lywq['Wechat']['antiRedSupply'] != 1) { echo 'style="display:none;"';} ?> >
           <label class="layui-form-label">返回数据key：</label>
           <div class="layui-input-inline">
              <input type="text" name="lywq_Wechat_antiRedKey" placeholder="请填写返回数据结果对应的key" value="<?php echo $lywq['Wechat']['antiRedKey'];?>" autocomplete="off" class="layui-input">
           </div>
	    </div>

        <!-- 保存 -->
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="systemsave">保存配置</button></div>
        </div>
    </div>
    <!--密码设置-->
    <div class="layui-tab-item">
      <blockquote class="layui-elem-quote layui-quote-nm">
        <p><span style="color:red;">小提示：</span>微信对接观影密码设置，配合可以实现用户关注公众号获取密码后才能观看影片</p>
        <p><span style="color:red;">注意：</span>本插件为模板辅助插件，请在模板中（<span style="color:red;">vod / play.html文件</span>）插入如下代码：<span style="font-weight:bold;color:green;">{php}require('./addons/Wechat/html/lywq_WechatPwd.html');{/php}</span></p>
      </blockquote>
      
        <div class="layui-form-item">
          <label class="layui-form-label">状态</label>
          <div class="layui-input-inline">
            <input type="checkbox" name="lywq_Wechat_passwordstatus" lay-skin="switch" lay-text="开启|关闭" value="1" <?php echo $lywq['Wechat']['passwordstatus']?'checked':'';?>>
          </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">多端密码：</label>
            <div class="layui-input-inline" style="width:500px;">
                <input type="checkbox" lay-skin="primary" name="lywq_Wechat_terminal[]" value="pc" title="电脑端" <?php echo strpos($lywq['Wechat']['terminal'],'pc')!==false?'checked':'';?> >
                <input type="checkbox" lay-skin="primary" name="lywq_Wechat_terminal[]" value="android" title="Android端" <?php echo strpos($lywq['Wechat']['terminal'],'android')!==false?'checked':'';?> >
                <input type="checkbox" lay-skin="primary" name="lywq_Wechat_terminal[]" value="ios" title="ios端" <?php echo strpos($lywq['Wechat']['terminal'],'ios')!==false?'checked':'';?> >
                <input type="checkbox" lay-skin="primary" name="lywq_Wechat_terminal[]" value="weixin" title="微信端" <?php echo strpos($lywq['Wechat']['terminal'],'weixin')!==false?'checked':'';?> >
                <input type="checkbox" lay-skin="primary" name="lywq_Wechat_terminal[]" value="qq" title="QQ端" <?php echo strpos($lywq['Wechat']['terminal'],'qq')!==false?'checked':'';?> >
                <input type="checkbox" lay-skin="primary" name="lywq_Wechat_terminal[]" value="bsl" title="变色龙" <?php echo strpos($lywq['Wechat']['terminal'],'bsl')!==false?'checked':'';?> >
            </div>
            <div class="layui-form-mid layui-word-aux">勾选需要密码访问的终端</div>
        </div>        
	    <div class="layui-form-item">
	       <label class="layui-form-label">密码关键字：</label>
	       <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_passwordkey" placeholder="请填写获取密码关键字" value="<?php echo $lywq['Wechat']['passwordkey'];?>" autocomplete="off" class="layui-input">
	       </div>
	       <div class="layui-form-mid layui-word-aux">公众号发送指定关键字获取密码</div>
	    </div>
	    <div class="layui-form-item">
	       <label class="layui-form-label">密码内容：</label>
	       <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_passwordtext" placeholder="请填写密码内容" value="<?php echo $lywq['Wechat']['passwordtext'];?>" autocomplete="off" class="layui-input">
	       </div>
	    </div>
      <div class="layui-form-item">
          <label class="layui-form-label">自动密码：</label>
          <div class="layui-input-inline" style="width:330px;">
            <input type="radio" name="lywq_Wechat_RndPassword" value="0" title="关闭" <?php echo $lywq['Wechat']['RndPassword']==0?'checked':'';?>>
            <input type="radio" name="lywq_Wechat_RndPassword" value="1" title="自动触发" <?php echo $lywq['Wechat']['RndPassword']==1?'checked':'';?>>
            <input type="radio" name="lywq_Wechat_RndPassword" value="2" title="定时任务" <?php echo $lywq['Wechat']['RndPassword']==2?'checked':'';?>>
          </div>
          <div class="layui-form-item" <?php if ($lywq['Wechat']['RndPassword'] != 1) { echo 'style="display:none;"';} ?> >
            <label class="layui-form-label">间隔时间：</label>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_RndPasswordH" placeholder="请填写自动触发间隔时间" value="<?php echo $lywq['Wechat']['RndPasswordH'];?>" autocomplete="off" class="layui-input">
            </div>
           <button class="layui-btn" onclick="javascript(0);"><a target="_blank" href="<?php echo $ssl.$_SERVER['HTTP_HOST'];?>/addons/Wechat/config/RndPassword.php?token=<?php echo $lywq['Wechat']['token'];?>&type=1">执行触发</a></button>
              <div class="layui-form-mid layui-word-aux">单位小时。首次开启请手动点击执行。</div>
          </div>
          <div class="layui-form-mid layui-word-aux" <?php if ($lywq['Wechat']['RndPassword'] != 2) { echo 'style="display:none;"';} ?> >定时访问url：<a target="_blank" href="<?php echo $ssl.$_SERVER['HTTP_HOST'];?>/addons/Wechat/config/RndPassword.php?token=<?php echo $lywq['Wechat']['token'];?>&type=2"><?php echo $ssl.$_SERVER['HTTP_HOST'];?>/addons/Wechat/config/RndPassword.php?token=<?php echo $lywq['Wechat']['token'];?>&type=2</a> （建议使用宝塔定时任务访问url）</div>
      </div>
	    <div class="layui-form-item">
	       <label class="layui-form-label">详情描述：</label>
	       <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_passworddesc" placeholder="请填写详情描述" value="<?php echo $lywq['Wechat']['passworddesc'];?>" autocomplete="off" class="layui-input">
	       </div>
	    </div>
        <div class="layui-form-item">
          <label class="layui-form-label">返回图片：</label>
          <div class="layui-input-inline">
        	<input type="text" name="lywq_Wechat_passwordimage" placeholder="请填写返回图片地址" value="<?php echo $lywq['Wechat']['passwordimage'];?>" autocomplete="off" class="layui-input upload-input upload-img">
          </div>
          <div class="layui-input-inline" style="width:100px;">
            <span class="layui-btn layui-upload">上传图片</span>
          </div>
          <div class="layui-form-mid layui-word-aux">公众号密码返回图文显示的图片,填写地址需带http</div>
        </div>
	    <div class="layui-form-item">
	       <label class="layui-form-label">返回地址：</label>
	       <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_passwordurl" placeholder="请填写返回地址" value="<?php echo $lywq['Wechat']['passwordurl'];?>" autocomplete="off" class="layui-input">
	       </div>
	    </div>
        <div class="layui-form-item">
          <label class="layui-form-label">公众号图片：</label>
          <div class="layui-input-inline">
        	<input type="text" name="lywq_Wechat_gzhimage" placeholder="请填写公众号图片地址" value="<?php echo $lywq['Wechat']['gzhimage'];?>" autocomplete="off" class="layui-input upload-input upload-img">
          </div>
          <div class="layui-input-inline" style="width:100px;">
            <span class="layui-btn layui-upload">上传图片</span>
          </div>
          <div class="layui-form-mid layui-word-aux">密码页提示关注公众号,填写地址需带http</div>
        </div>

     <!-- 保存 -->
     <div class="layui-form-item">
    	<div class="layui-input-block">
        	<button class="layui-btn" lay-submit lay-filter="systemsave">保存配置</button>
    	</div>
     </div>
    </div>
    <!--关键词设置-->
    <div class="layui-tab-item">
      <blockquote class="layui-elem-quote layui-quote-nm">
        <p><span style="color:red;">小提示：</span>拓展功能持续开发中。。。</p>
      </blockquote>

        <div class="layui-form-item">
            <label class="layui-form-label">
                关键词1：</label>
            <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_gjc1" placeholder="关键词1" value="<?php echo $lywq['Wechat']['gjc1'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcm1" placeholder="返回文字" value="<?php echo $lywq['Wechat']['gjcm1'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjci1" placeholder="返回图片" value="<?php echo $lywq['Wechat']['gjci1'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcl1" placeholder="返回链接" value="<?php echo $lywq['Wechat']['gjcl1'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                关键词2：</label>
            <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_gjc2" placeholder="关键词2" value="<?php echo $lywq['Wechat']['gjc2'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcm2" placeholder="返回文字" value="<?php echo $lywq['Wechat']['gjcm2'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjci2" placeholder="返回图片" value="<?php echo $lywq['Wechat']['gjci2'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcl2" placeholder="返回链接" value="<?php echo $lywq['Wechat']['gjcl2'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                关键词3：</label>
            <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_gjc3" placeholder="关键词3" value="<?php echo $lywq['Wechat']['gjc3'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcm3" placeholder="返回文字" value="<?php echo $lywq['Wechat']['gjcm3'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjci3" placeholder="返回图片" value="<?php echo $lywq['Wechat']['gjci3'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcl3" placeholder="返回链接" value="<?php echo $lywq['Wechat']['gjcl3'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                关键词4：</label>
            <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_gjc4" placeholder="关键词4" value="<?php echo $lywq['Wechat']['gjc4'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcm4" placeholder="返回文字" value="<?php echo $lywq['Wechat']['gjcm4'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjci4" placeholder="返回图片" value="<?php echo $lywq['Wechat']['gjci4'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcl4" placeholder="返回链接" value="<?php echo $lywq['Wechat']['gjcl4'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                关键词5：</label>
            <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_gjc5" placeholder="关键词5" value="<?php echo $lywq['Wechat']['gjc5'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcm5" placeholder="返回文字" value="<?php echo $lywq['Wechat']['gjcm5'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjci5" placeholder="返回图片" value="<?php echo $lywq['Wechat']['gjci5'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcl5" placeholder="返回链接" value="<?php echo $lywq['Wechat']['gjcl5'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">
                关键词6：</label>
            <div class="layui-input-inline">
	          <input type="text" name="lywq_Wechat_gjc6" placeholder="关键词6" value="<?php echo $lywq['Wechat']['gjc6'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcm6" placeholder="返回文字" value="<?php echo $lywq['Wechat']['gjcm6'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjci6" placeholder="返回图片" value="<?php echo $lywq['Wechat']['gjci6'];?>" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-input-inline">
                <input type="text" name="lywq_Wechat_gjcl6" placeholder="返回链接" value="<?php echo $lywq['Wechat']['gjcl6'];?>" autocomplete="off" class="layui-input">
            </div>
        </div>
     <!-- 保存 -->
     <div class="layui-form-item">
    	<div class="layui-input-block">
        	<button class="layui-btn" lay-submit lay-filter="systemsave">保存配置</button>
    	</div>
     </div>
    </div>
  </div>
</div>
</form>


<script>
layui.use(['layer', 'form', 'table', 'upload', 'element'], function(){
  var layer = layui.layer 
  ,form = layui.form
  ,table = layui.table 
  ,upload = layui.upload
  ,element = layui.element
  var upload_path = '';
  if($('.j-ajax', parent.document).attr('href')){
	  
  }
  var upload_path = $('.j-ajax', parent.document).attr('href').replace('/index/clear.html', '') + '/upload/upload.html?flag=addon';
  var ishttps = 'https:' == document.location.protocol ? 'https://': 'http://';
        upload.render({
            elem: '.layui-upload'
            ,url: upload_path
            ,method: 'post'
            ,before: function(input) {
                layer.msg('文件上传中...', {time:3000000});
            },done: function(res, index, upload) {
                var obj = this.item;
                if (res.code == 0) {
                    layer.msg(res.msg);
                    return false;
                }
                layer.closeAll();
                var input = $(obj).parent().parent().find('.upload-input');
                if ($(obj).attr('lay-type') == 'image') {
                    input.siblings('img').attr('src', res.data.file).show();
                }
                input.val(ishttps+window.location.host+'/'+res.data.file);
            }
        });

  form.on('submit(systemsave)', function(data){
    console.log(JSON.stringify(data.field));
    data.field.lywq_Wechat_status = data.field.lywq_Wechat_status?data.field.lywq_Wechat_status:'0';
    data.field.lywq_Wechat_antiRedSupply = data.field.lywq_Wechat_antiRedSupply?data.field.lywq_Wechat_antiRedSupply:'0';
    data.field.lywq_Wechat_antiRedType = data.field.lywq_Wechat_antiRedType?data.field.lywq_Wechat_antiRedType:'0';
    
    data.field.lywq_Wechat_bofang = data.field.lywq_Wechat_bofang?data.field.lywq_Wechat_bofang:'2';
    data.field.lywq_Wechat_msgtype = data.field.lywq_Wechat_msgtype?data.field.lywq_Wechat_msgtype:'0';
    data.field.lywq_Wechat_antiRedStatus = data.field.lywq_Wechat_antiRedStatus?data.field.lywq_Wechat_antiRedStatus:'0';
    
    data.field.lywq_Wechat_passwordstatus = data.field.lywq_Wechat_passwordstatus?data.field.lywq_Wechat_passwordstatus:'0';
    data.field.lywq_Wechat_RndPassword = data.field.lywq_Wechat_RndPassword?data.field.lywq_Wechat_RndPassword:'0';
    data.field.lywq_Wechat_RndPasswordH = data.field.lywq_Wechat_RndPasswordH?data.field.lywq_Wechat_RndPasswordH:'24';
    
    $.ajax({
        url: "save.php",
        data: data.field,
        type: "post", 
		dataType: 'json',
        success: function (data) {
			layer.msg(data.msg, {icon: data.icon});
            form.render();
            location.reload();
        },
        error: function () {
            layer.alert("保存配置执行异常!", {icon: 5});
        }
    });				  
    return false;	
  });
});

        $('.upload-img').hover(function (e){
            var e = window.event || e;
            var imgsrc = $(this).val();
            if(imgsrc.trim()==""){ return; }
            var left = e.clientX+document.body.scrollLeft+20;
            var top = e.clientY+document.body.scrollTop+20;
            $(".showpic").css({left:left,top:top,display:""});
            $(".showpic_img").attr("src", imgsrc);
        },function (e){
            $(".showpic").css("display","none");
        });
</script>
</body>
</html>